package com.milling.quartz.task;

import com.milling.business.service.IWmsNeedleSorttingService;
import com.milling.common.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * 定时任务 将分拣区数量 同步到数据库，如果数量为0，则清空分拣位，运行补料；
 *
 * @author X
 */
@Configuration
@ConditionalOnProperty(
        name = "mac.type",
        havingValue = "2",
        matchIfMissing = false // 当配置缺失时不加载
)
@Component("needleSortService")
public class NeedleSortingService
{
    private static final Logger logger = LoggerFactory.getLogger(NeedleSortingService.class);

    @Autowired
    private IWmsNeedleSorttingService wmsNeedleSorttingService;

    public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i)
    {
        logger.info(StringUtils.format("执行多参方法： 字符串类型{}，布尔类型{}，长整型{}，浮点型{}，整形{}", s, b, l, d, i));
    }

    public void ryParams(String params)
    {
        System.out.println("执行有参方法：" + params);
    }

    public void ryNoParams()
    {
        System.out.println("执行无参方法");
    }

    public void handlerTask()
    {
        wmsNeedleSorttingService.sysncNeedleSortingStatus();
    }
}
